﻿namespace WP7Contrib.Messaging.Tests.ViewModels
{
    using System;
    using GalaSoft.MvvmLight.Messaging;
    using Messages;

    public sealed class ReceiverViewModel
    {
        private readonly IMessenger messenger;
        private Action<UserMessage> action;
        private Action<UserMessageWithIgnoreReplay> action2;

        public ReceiverViewModel(IMessenger messenger)
        {
            this.messenger = messenger;
        }

        public void RegisterForUserMessage(Action<UserMessage> action)
        {
            this.action = action;
            this.messenger.Register(this, this.action);
        }

        public void RegisterForUserMessage(Action<UserMessageWithIgnoreReplay> action)
        {
            this.action2 = action;
            this.messenger.Register(this, this.action);
        }
    }
}